package server;

import java.io.Serializable;

/**
 * A password entry for user validation.
 */
public class Password implements Serializable {
	private static final long serialVersionUID = 4752376182627392568L;

	/**
	 * Creates a new password entry.
	 * @param user The user's name.
	 * @param password The user's password.
	 * @param type The user's type (simple / expert).
	 */
	public Password(String user, String password, typeOpt type) {
		this.user = user;
		this.password = password;
		this.type = type;
	}

    public boolean equals(Object other) {
        if (!(other instanceof Password)) {
            return false;
        }

        Password o = (Password)other;
        return (
            (((password == null) && (o.password == null)) || 
                (o.password.equals(password))) &&
            (((user == null) && (o.user == null)) || 
                (o.user.equals(user))) &&
            (((type == null) && (o.type == null)) || 
                (o.type.equals(type)))
            );
    }


	public static enum typeOpt {SIMPLE, EXPERT};
	public String user;
	public String password;
	public typeOpt type;
}
